package com.zhouheng.springbootactiviti.module.service.impl;

import com.zhouheng.springbootactiviti.common.pojo.SysUser;
import com.zhouheng.springbootactiviti.module.mapper.SysUserMapper;
import com.zhouheng.springbootactiviti.module.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

@Service
public class SysUserServiceImpl implements SysUserService {

    @Autowired
    private SysUserMapper sysUserMapper;

    @Override
    public List<SysUser> list() {
        List<SysUser> all = sysUserMapper.findAll();
        if (!CollectionUtils.isEmpty(all)) {
            all.forEach(user -> user.setPassword(null));
        }
        return all;
    }

}
